package com.study.excel.easyexcel;

import ch.qos.logback.core.boolex.EvaluationException;
import com.study.saAuth.UserController;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Utils {
    public static String getPath(){
        String path = Utils.class.getResource("/").getPath();
        return path;
    }

    public static void main(String[] args) throws Exception{

        Class.forName("com.study.saAuth.UserController");
        // 创建一个字节数组输入流
        byte[] data = "Hello, world!".getBytes();
        InputStream inputStream = new ByteArrayInputStream(data);
        ClassLoader classLoader = InputStream.class.getClassLoader();
        ClassLoader classLoader2 = EvaluationException.class.getClassLoader();
        System.out.println(classLoader2);
        ClassLoader classLoader1 = UserController.class.getClassLoader();
        System.out.println(classLoader1);
        // 第一次读取
        System.out.println("第一次读取：");
        int ch;
        while ((ch = inputStream.read()) != -1) {
            System.out.print((char) ch);
        }
        System.out.println();

        // 重置输入流
        inputStream.reset();

        // 第二次读取
        System.out.println("第二次读取：");
        while ((ch = inputStream.read()) != -1) {
            System.out.print((char) ch);
        }
        System.out.println();

        // 关闭输入流
        inputStream.close();
    }
}
